xend: allow config file compatibility with new tap syntax
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 16 Jun 2009 10:00:29 +0000 (11:00 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 16 Jun 2009 10:00:29 +0000 (11:00 +0100)
Recently the format of the tap syntax in the config file changed to
using a 4 part specifier (tap:tapdisk:<format>:<filename>) instead
of the old 3-part one (tap:<qcow>:<filename>).
This breaks compatibility with existing config files: a guest start
will throw a Python exception and will be aborted.
AFAICS currently tap:tapdisk is redundant, so the attached patch
simply catches the above mentioned exception and tries to parse the
old format in this case.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
tools/python/xen/xend/server/BlktapController.py

index 7c592932c29f8ce9510b52ca614be8f72a3525c9..59fb2f78aa40eabbc6362b7ede3eca12f89e6f7c 100644 (file)
@@ -120,8 +120,12 @@ class BlktapController(BlkifController):
 
     def createDevice(self, config):
 
-        uname = config.get('uname', '')        
-        (typ, subtyp, params, file) = string.split(uname, ':', 3)
+        uname = config.get('uname', '')
+        try:
+            (typ, subtyp, params, file) = string.split(uname, ':', 3)
+        except:
+            (typ, params, file) = string.split(uname, ':', 2)
+            subtyp = 'tapdisk'
         if typ in ('tap'):
             if subtyp in ('tapdisk'):                                          
                 if params in ('ioemu', 'qcow2', 'vmdk', 'sync'):